{include file="layout/head.tpl"}
{include file="layout/menu.tpl"}

{literal}

<script type="text/javascript" src="include/js/jquery.validate.min.js"></script>

<script type="text/javascript">
    
$().ready(function() {            	

    var usuarioID = $("#usuarioID").val();
        
    $("#frmCadAdmin").validate({
            rules: {
                    login: {
                            required: true,
                            minlength: 5,
                remote:{
                    url: "UsuarioAction.validaLogin",
                    type: "post",
                    data: {
                      usuarioID : usuarioID
                    }
                }
                    },
                    senha: {
                            required: true,
                            minlength: 5
                    },
                    r_senha: {
                            required: true,
                            minlength: 5,
                            equalTo: "#senha"
                    },
                    email: {
                            required: true,
                            email: true,
                remote:{
                    url: "UsuarioAction.validaEmail",
                    type: "post",
                    data: {
                      usuarioID : usuarioID
                    }
                }
                    },
                    media: {
                            accept: "gif|jpg|jpeg|png"
                    }
    						
            }
    });
});
</script>
{/literal}

<div id="content" class="block-border">

    <div class="block-content">
        <div class="h1 with-menu"><h1>Cadastro de Administradores</h1></div>

        {msg obj=$msg|default:null type="small"}
        {display_errors errors=$errosValidacao|default:null}

        <div class="columns">

            <div class="colx1-left">
                <!-- Add the class 'form' -->
                <form id="frmCadAdmin" action="AdminAction.salvar" class="form" method="post" enctype="multipart/form-data">

                    <input type="hidden" name="usuarioID" id="usuarioID" value="{$usuarioID|default:0}" />

                    <fieldset>
                        <legend>Dados de Acesso</legend>
                        {include file="view/usuario/formSimples.tpl"}
                    </fieldset>

                    <fieldset>
                        <legend>Imagem</legend>
                        {include file="view/media/formImagem.tpl"}
                    </fieldset>

                    <div class="btAction">
                         {action_button label="Limpar" type="reset" class="grey"}
                         {action_button label="Salvar" type="submit" icon="fugue/tick-circle.png"}
                    </div>

                </form>
            </div>
        </div>
    </div>





</div>

{include file="layout/footer.tpl"}